import axios from 'axios'

axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'

// 创建axios实例
const service = axios.create({
  // axios中请求配置有baseURL选项，表示请求URL公共部分
  // baseURL: process.env.VUE_APP_BASE_API,
  baseURL: 'http://localhost:3001',
  // 超时
  timeout: 120000,
})

service.interceptors.request.use((request) => {
  // add token
  // request.headers["Authorization"] = "Bearer " ;
  return request
})

service.interceptors.response.use((res) => {
  return res.data
})

export default service
